<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<ui:composition xmlns="http://www.w3.org/1999/xhtml"
		xmlns:cc="http://java.sun.com/jsf/composite"
		xmlns:ui="http://java.sun.com/jsf/facelets"
		xmlns:h="http://java.sun.com/jsf/html"
		xmlns:f="http://java.sun.com/jsf/core"
		xmlns:p="http://primefaces.org/ui"
		xmlns:comps="http://java.sun.com/jsf/composite/components">

		<cc:interface>

			<cc:attribute name="tituloCategoria" required="true" />
			<cc:attribute name="noticiasCategoria" required="true" />
			<cc:attribute name="itensPorPagina" required="true" />

		</cc:interface>

		<cc:implementation>
		
			<h:panelGroup>
			
				<h:panelGroup layout="block" styleClass="categoriaComponenteTitulo">
					<h:outputText value="#{cc.attrs.tituloCategoria}" />
				</h:panelGroup>
			
			</h:panelGroup>

			<h:form id="postsForm">
				
				<p:dataList id="postsList"
					styleClass="noticiaDataList" 
					var="post" value="#{cc.attrs.noticiasCategoria}"
					paginator="true" paginatorAlwaysVisible="true" paginatorPosition="bottom"
					rows="#{cc.attrs.itensPorPagina}"
					type="none">
					
					<h:panelGroup id="postIndividual" layout="block" styleClass="categoriaComponenteNoticiaItem">
						
						<h:panelGroup layout="block" styleClass="postGeralAutorData">
						
							<h:panelGroup layout="block" styleClass="categoriaComponenteNoticiaTitulo">
							
								<h:outputText value="#{post.titulo}" />
								
							</h:panelGroup>
							
							<h:panelGroup layout="block" styleClass="categoriaComponenteNoticiaInfo">
							
								<h:outputText value="Por #{post.autor.nome}, em " />
								<h:outputText value="#{post.data}">
									<f:convertDateTime pattern="EEEE, dd 'de' MMMM 'de' yyyy" />
								</h:outputText>
								
							</h:panelGroup>
							
						</h:panelGroup>
						
						<h:panelGroup layout="block" styleClass="categoriaComponenteNoticiaTexto">
							<h:outputText value="#{post.conteudo}" escape="false" />	
						</h:panelGroup>	
					
						<h:panelGroup layout="block"
							styleClass="postGeralRodape">
							
							<h:panelGrid columns="5">

								<p:commandButton
									icon="ui-icon-comment"
									style="font-size: 0.6em !important;"
									value="comentarios [#{post.comentarios.size()}]"
									action="#{PaginaInicialBean.prepararComentario(post)}" />
								
								<p:spacer width="3" />
									
								<p:commandButton id="imprimirPostBtn" 
									style="font-size: 0.6em !important;"
									type="button"
									icon="ui-icon-print"
									value="Imprimir">
									<p:printer target="postIndividual" />
								</p:commandButton>
								
								<p:spacer width="3" />
								
								<p:commandButton
									icon="ui-icon-plus"
									style="font-size: 0.6em !important;"
									value="Curtir [#{post.voto}]"
									update="@all"
									action="#{PaginaInicialBean.votarNoticia(post)}" />														
								
							</h:panelGrid>
						
						</h:panelGroup>
					
					</h:panelGroup>					
				
				</p:dataList>				
			
			</h:form>		
		
		</cc:implementation>

</ui:composition>